package com.woniu.finance.contorller;


import com.woniu.aop.OperationLogAnnotation;
import com.woniu.finance.entity.Permission;
import com.woniu.finance.service.IPermissionService;
import com.woniu.util.utils.HttpResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 权限表 前端控制器
 * </p>
 *
 * @author 杨鹏
 * @since 2023-04-25
 */
@RestController
@RequestMapping("/finance/permission")
public class PermissionController {
    @Autowired
    private IPermissionService permissionService;

    //添加
    @PostMapping("/savePermission")
    @OperationLogAnnotation(operModul = "融资企业-权限表",operType = "新增",operDesc = "新增权限表")//操作日志注解
    public HttpResult<?> savePermission(@RequestBody Permission permission){
        return permissionService.savePermission(permission);
    }

    //删除
    @RequestMapping("/removePermission")
    @OperationLogAnnotation(operModul = "融资企业-权限表",operType = "删除",operDesc = "删除权限表")//操作日志注解
    public HttpResult<?> removePermission(Integer id){
        return permissionService.removePermissionById(id);
    }

    //修改
    @PostMapping("/modifyPermission")
    @OperationLogAnnotation(operModul = "融资企业-权限表",operType = "修改",operDesc = "修改权限表")//操作日志注解
    public HttpResult<?> modifyPermission(@RequestBody Permission permission){
        return permissionService.modifyPermission(permission);
    }

    //查全部
    @RequestMapping("/findAllPermission")
    @OperationLogAnnotation(operModul = "融资企业-权限表",operType = "查询",operDesc = "查询所有权限表")//操作日志注解
    public HttpResult<?> findAllPermission(){
        return permissionService.findAllPermission();
    }

    @RequestMapping("/findAllPermissionById")
    @OperationLogAnnotation(operModul = "融资企业-权限表",operType = "查询",operDesc = "查询id查询权限表")//操作日志注解
    public HttpResult<?> findPermissionById(Integer id){
        return permissionService.findPermissionById(id);
    }
}
